Skip to content

chore: Compatibility with fee based tokens#330

Closed
tuliomir wants to merge 2 commits intomasterfrom
chore/fee-tokens-compat
Closed

chore: Compatibility with fee based tokens#330
tuliomir wants to merge 2 commits intomasterfrom
chore/fee-tokens-compat

Conversation

@tuliomir
Copy link
Contributor

@tuliomir tuliomir commented Dec 9, 2025

Motivation

The changes on Fee Token Creation ( HathorNetwork/hathor-wallet-lib#858 ) have created a compatibility issue for the tests inside HathorNetwork/hathor-wallet-lib#949 . This PR aims to solve this compatibility minimally before the actual implementation of the fee-based tokens are made here.

Acceptance Criteria

  • Compatibilizes the token response from the Wallet Service with the new properties of the Fee Tokens

Checklist

  • If you are requesting a merge into master, confirm this code is production-ready and can be included in future releases as soon as it gets merged
  • Make sure either the unit tests and/or the QA tests are capable of testing the new features
  • Make sure you do not include new dependencies in the project unless strictly necessary and do not include dev-dependencies as production ones. More dependencies increase the possibility of one of them being hijacked and affecting us.

@tuliomir tuliomir self-assigned this Dec 9, 2025
@tuliomir tuliomir moved this from Todo to In Progress (Done) in Hathor Network Dec 9, 2025
@tuliomir tuliomir moved this from In Progress (Done) to In Progress (WIP) in Hathor Network Dec 9, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Comment on lines +194 to +202
version: TokenVersion;

transactions: number;

constructor(id: string, name: string, symbol: string, transactions?: number) {
this.id = id;
this.name = name;
this.symbol = symbol;
this.version = TokenVersion.DEPOSIT; // Hardcoded for now, while the Fee Tokens implementation is not complete
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new version property is not covered by existing tests. The test at line 1260 in tests/db.test.ts uses toStrictEqual to compare TokenInfo objects, which will now include the version field in the comparison. However, since both the stored and retrieved TokenInfo objects will have the same hardcoded TokenVersion.DEPOSIT value (due to the bug where version is not persisted), the test will pass even though the version functionality is not working correctly.

Consider adding explicit test cases that:

  1. Verify the version field is correctly set for native tokens (should be NATIVE)
  2. Verify the version field is correctly set for custom tokens (should match what was stored)
  3. Test that different token versions can be stored and retrieved correctly

Copilot uses AI. Check for mistakes.
Comment on lines +176 to +185
/**
* Token version used to identify the type of token during the token creation process.
*/
export enum TokenVersion {
NATIVE = 0,

DEPOSIT = 1,

FEE = 2,
}
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JSDoc comment for the TokenVersion enum mentions it's used "during the token creation process," but this doesn't fully explain what each version type means or when each should be used. Consider expanding the documentation to clarify:

  • What differentiates NATIVE, DEPOSIT, and FEE tokens
  • Which version should be used for which scenarios
  • Any implications or restrictions for each version type

This will help future developers understand how to properly use these token version types.

Copilot uses AI. Check for mistakes.
@tuliomir
Copy link
Contributor Author

This PR was supposed to solve an issue in HathorNetwork/hathor-wallet-lib#949 , but a workaround was implemented there instead.

The Fee Based tokens will be implemented in a dedicated PR in the future.

@tuliomir tuliomir closed this Dec 17, 2025
@github-project-automation github-project-automation bot moved this from In Progress (WIP) to Waiting to be deployed in Hathor Network Dec 17, 2025
@tuliomir tuliomir moved this from Waiting to be deployed to Done in Hathor Network Dec 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants